/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.srcptit.trainning.b1;

import java.util.Scanner;

/**
 *
 * @author Administrator
 */
public class B6_soThuanNghich {
    public static void main(String[] args) {
        lietKe(6);
    }
    static boolean soTN(long n){
        long k = 0, kq = n;
        while(kq>0){
            k = 10*k + kq%10;
            kq /= 10;
        }
        return (n==k);
    }
    static void lietKe(int n){
        long n1 = (long)Math.pow(10,n-1);
        long n2 = (long)Math.pow(10, n);
        for(long i=n1;i<n2;i++)
            System.out.print((soTN(i))?("\n"+i):(""));
    }
}
